package com.anolesoft.amljmes.billing.controller;

import com.anolesoft.amljmes.billing.dto.StfDeptDto;
import com.anolesoft.amljmes.billing.service.StfDeptservice;
import com.anolesoft.common.core.domain.LoginUser;
import com.anolesoft.common.core.web.domain.AjaxResult;
import com.anolesoft.common.security.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/jdbm/stfdept")
public class StfDeptController {
    @Autowired
    public StfDeptservice stfDeptservice;

    //动态下拉
    @PostMapping(value="/all",produces = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public AjaxResult departmentAll(){
//        List<StfDeptDto> list = stfDeptservice.departmentAll();
        LoginUser loginUser = SecurityUtils.getLoginUser();
        List<StfDeptDto> list = stfDeptservice.queryDepartmentByFactory(loginUser.getFacCode());
        AjaxResult success = AjaxResult.success();
        success.put("data", list);
        return success;
    }
}
